from requests.api import request


class BaseRequest(object):
    def requests_base(self, method, url, Data=None, Params=None, headers=None):
        if Data is None:
            self.data = {}
        else:
            self.data = Data

        if Params is None:
            self.params = {}
        else:
            self.params = Params

        if headers is None:
            self.headers = {}

        self.headers = headers
        self.method = method
        self.url = url

        res = request(method=method, url=url, headers=self.headers, data=self.data, params=self.params)
        return res.json()

    def get_data(self, path):
        pass


# params = {"user":"king"}
# res = BaseRequest().requests_base("GET", "http://httpbin.org/get",Params=params)
# print(res)
